import java.io.*;

class AFKCheck extends Thread
{
	public boolean sniping = false;
	long duration;
	Match match;

	public AFKCheck(long t, Match m)
	{
		duration = t;
		match = m;
	}

	public void run()
	{
		try
		{
			Thread.sleep(30000);
		}
		catch (InterruptedException e)
		{
			// Normal exit
			return;
		}

		sniping = true;
		LeagueBot.sendMsg(LeagueBot.channel, "30 seconds have passed, other players can join the match for " + match.getType());

		try
		{
			Thread.sleep(duration - 30000);
		}
		catch (InterruptedException e)
		{
			// Normal exit
			return;
		}

		// Cancel the match due to timeout
		match.timedOut();
	}
}
